package com.youlai.boot.system.model.entity;

import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import com.youlai.boot.common.listener.CreatedByListenerFlag;
import com.youlai.boot.common.listener.UpdatedByListenerFlag;
import lombok.Getter;
import lombok.Setter;

import java.time.LocalDateTime;
import java.util.Date;

/**
 * 通知公告实体对象
 *
 * @author youlaitech
 * @since 2024-08-27 10:31
 */
@Getter
@Setter
@Table(value = "sys_notice")
public class SysNoticeEntity implements CreatedByListenerFlag, UpdatedByListenerFlag {
    /**
     * 主键ID
     */
    @Id(keyType = KeyType.Auto)
    private Long id;

    /**
     * 通知标题
     */
    @Column(value = "title")
    private String title;

    /**
     * 通知内容
     */
    @Column(value = "content")
    private String content;

    /**
     * 通知类型
     */
    @Column(value = "type")
    private Integer type;

    /**
     * 发布人
     */
    @Column(value = "publisher_id")
    private Long publisherId;

    /**
     * 通知等级（L: 低, M: 中, H: 高）
     */
    @Column(value = "level")
    private String level;

    /**
     * 目标类型（1: 全体, 2: 指定）
     */
    @Column(value = "target_type")
    private Integer targetType;

    /**
     * 目标用户ID集合
     */
    @Column(value = "target_user_ids")
    private String targetUserIds;

    /**
     * 发布状态（0: 未发布, 1: 已发布, -1: 已撤回）
     */
    @Column(value = "publish_status")
    private Integer publishStatus;

    /**
     * 发布时间
     */
    @Column(value = "publish_time")
    private LocalDateTime publishTime;

    /**
     * 撤回时间
     */
    @Column(value = "revoke_time")
    private LocalDateTime revokeTime;

    /**
     * 创建人ID
     */
    @Column(value = "created_by")
    private Long createdBy;

    /**
     * 更新人ID
     */
    @Column(value = "updated_by")
    private Long updatedBy;

    /**
     * 逻辑删除
     */
    @Column(value = "is_deleted", isLogicDelete = true)
    private Integer isDeleted;

    /**
     * 创建时间
     */
    @Column(value = "create_time", onInsertValue = "now()")
    private Date createTime;

    /**
     * 更新时间
     */
    @Column(value = "update_time", onInsertValue = "now()", onUpdateValue = "now()")
    private Date updateTime;
}
